Enable bracketed paste mode when sending lines to the repl #384
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem
Recently, after returning to some Python projects, I noticed a problem with iron.nvim's core.send_file() function. While the function still pushes all lines to the REPL buffer, each line's indentation increases by one. This issue arose in my environment where I'm using ptpython on macOS.
The fix
Upon investigating, it appears the issue stems from lowlevel.send_to_repl(). The function wasn't initiating bracket paste mode, which seems to be the root of the problem. I implemented a patch that triggers bracketed paste mode before sending code to the REPL, which resolved the issue in my setup. While I'm not certain if this issue is widespread or what other setups it might impact, this solution has worked well for me so far.
I hope this fix can be helpful to others experiencing similar issues!